using APP.HELPER.Data.Helper;
using System;
using System.Data;
using System.Data.SqlClient;

namespace Service
{
    public class Customer
    {
        private int _mIdCustomer;
        private string _mNameCompany;
        private string _mAddress;
        private string _mTell;
        private string _mMobile;
        private string _mFax;
        private string _mWebsite;
        private string _mEmail;
        private string _mTaxID;
        private string _mBusinessLicense;
        private string _mContactMan;
        private string _mContents;
        public int IdCustomer
        {
            get
            {
                return this._mIdCustomer;
            }
            set
            {
                this._mIdCustomer = value;
            }
        }
        public string NameCompany
        {
            get
            {
                return this._mNameCompany;
            }
            set
            {
                this._mNameCompany = value;
            }
        }
        public string Address
        {
            get
            {
                return this._mAddress;
            }
            set
            {
                this._mAddress = value;
            }
        }
        public string Tell
        {
            get
            {
                return this._mTell;
            }
            set
            {
                this._mTell = value;
            }
        }
        public string Mobile
        {
            get
            {
                return this._mMobile;
            }
            set
            {
                this._mMobile = value;
            }
        }
        public string Fax
        {
            get
            {
                return this._mFax;
            }
            set
            {
                this._mFax = value;
            }
        }
        public string Website
        {
            get
            {
                return this._mWebsite;
            }
            set
            {
                this._mWebsite = value;
            }
        }
        public string Email
        {
            get
            {
                return this._mEmail;
            }
            set
            {
                this._mEmail = value;
            }
        }
        public string TaxID
        {
            get
            {
                return this._mTaxID;
            }
            set
            {
                this._mTaxID = value;
            }
        }
        public string ContactMan
        {
            get
            {
                return this._mContactMan;
            }
            set
            {
                this._mContactMan = value;
            }
        }
        public string Contents
        {
            get
            {
                return this._mContents;
            }
            set
            {
                this._mContents = value;
            }
        }
        public Customer()
        {
            this._mIdCustomer = 0;
            this._mNameCompany = "";
            this._mAddress = "";
            this._mTell = "";
            this._mMobile = "";
            this._mFax = "";
            this._mWebsite = "";
            this._mEmail = "";
            this._mTaxID = "";
            this._mBusinessLicense = "";
            this._mContactMan = "";
            this._mContents = "";
        }
        public string Get(int idCustomer)
        {
            string result = "";
            string[] myParams = new string[]
			{
				"@Id_Customer"
			};
            object[] parameterValues = new object[]
			{
				idCustomer
			};
            SqlHelper sqlHelper = new SqlHelper("HPqrGX/piQz0Xe4u/h/67gQ3uyF/l8Jnvceflfn0g5a097J0Dujgoj8bqG7F7buoYB2Mt+NKyXJ77rNdpJJ69tNga+CVb/KOMzARhvb5JWkXymCWnUJWzzgLCgblpEMy", "07071983", true);
            SqlDataReader sqlDataReader = sqlHelper.ExecuteReader(sqlHelper.Connection, CommandType.StoredProcedure, "CUSTOMER_GetById", myParams, parameterValues);
            if (sqlDataReader != null)
            {
                while (sqlDataReader.Read())
                {
                    this._mIdCustomer = Convert.ToInt32(sqlDataReader["Id_Customer"]);
                    this._mNameCompany = Convert.ToString(sqlDataReader["NameCompany"]);
                    this._mAddress = Convert.ToString(sqlDataReader["Address"]);
                    this._mTell = Convert.ToString(sqlDataReader["Tell"]);
                    this._mMobile = Convert.ToString(sqlDataReader["Mobile"]);
                    this._mFax = Convert.ToString(sqlDataReader["Fax"]);
                    this._mWebsite = Convert.ToString(sqlDataReader["Website"]);
                    this._mEmail = Convert.ToString(sqlDataReader["Email"]);
                    this._mTaxID = Convert.ToString(sqlDataReader["TaxID"]);
                    this._mBusinessLicense = Convert.ToString(sqlDataReader["BusinessLicense"]);
                    this._mContactMan = Convert.ToString(sqlDataReader["ContactMan"]);
                    this._mContents = Convert.ToString(sqlDataReader["Contents"]);
                    result = "OK";
                }
                sqlDataReader.Close();
                sqlHelper.Close();
            }
            return result;
        }
    }
}